/*
Copyright 2014, KISSY v1.47
MIT Licensed
build time: Aug 28 13:16
*/
KISSY.add("json/quote",[],function(m){var g={"":"\\b","":"\\f","\n":"\\n","\r":"\\r","\t":"\\t",'"':'\\"'},f={},j=/["\b\f\n\r\t\x00-\x1f]/g,c=/\\\\|\\\/|\\b|\\f|\\n|\\r|\\t|\\"|\\u[0-9a-zA-Z]{4}/g;m.each(g,function(a,e){f[a]=e});f["\\/"]="/";f["\\\\"]="\\";return{quote:function(a){return'"'+a.replace(j,function(a){var b;if(!(b=g[a]))b="\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4);return b})+'"'},unQuote:function(a){return a.slice(1,a.length-1).replace(c,function(a){var b;if(!(b=f[a]))b=
String.fromCharCode(parseInt(a.slice(2),16));return b})}}});
KISSY.add("json/stringify",["./quote"],function(m,g){function f(a){return 10>a?"0"+a:a}function j(a,e,b,o,h,g,k){var d=e[a];if(d&&"object"===typeof d)if("function"===typeof d.toJSON)d=d.toJSON(a);else if(d instanceof Date)d=isFinite(d.valueOf())?d.getUTCFullYear()+"-"+f(d.getUTCMonth()+1)+"-"+f(d.getUTCDate())+"T"+f(d.getUTCHours())+":"+f(d.getUTCMinutes())+":"+f(d.getUTCSeconds())+"Z":null;else if(d instanceof String||d instanceof Number||d instanceof Boolean)d=d.valueOf();void 0!==b&&(d=b.call(e,
a,d));switch(typeof d){case "number":return isFinite(d)?""+d:"null";case "string":return c.quote(d);case "boolean":return""+d;case "object":if(d)if(m.isArray(d)){for(var a=d,e=k,k=k+h,d=[],l=a.length,p=0;p<l;){var i=j(""+p,a,b,o,h,g,k);d[d.length]=void 0===i?"null":i;++p}d.length?h?(b=d.join("\n,"+k),b="[\n"+k+b+"\n"+e+"]"):b="["+d.join(",")+"]":b="[]"}else{for(var a=d,e=k,k=k+h,n,d=void 0!==o?o:m.keys(a),i=[],p=0,l=d.length;p<l;p++){n=d[p];var q=j(n,a,b,o,h,g,k);void 0!==q&&(n=c.quote(n),n+=":",
h&&(n+=" "),n+=q,i[i.length]=n)}i.length?h?(b=i.join(",\n"+k),b="{\n"+k+b+"\n"+e+"}"):b="{"+i.join(",")+"}":b="{}"}else b="null";return b}}var c=g("./quote");return function(a,e,b){var c="",h,f;e&&("function"===typeof e?f=e:m.isArray(e)&&(h=e));"number"===typeof b?(b=Math.min(10,b),c=Array(b+1).join(" ")):"string"===typeof b&&(c=b.slice(0,10));return j("",{"":a},f,h,c,[],"")}});
KISSY.add("json/parser",[],function(){var m={},g=KISSY,f=function(c){this.rules=[];g.mix(this,c);this.resetInput(this.input)};f.prototype={constructor:function(c){this.rules=[];g.mix(this,c);this.resetInput(this.input)},resetInput:function(c){g.mix(this,{input:c,matched:"",stateStack:[f.STATIC.INITIAL],match:"",text:"",firstLine:1,lineNumber:1,lastLine:1,firstColumn:1,lastColumn:1})},getCurrentRules:function(){var c=this.stateStack[this.stateStack.length-1],a=[],c=this.mapState(c);g.each(this.rules,
function(e){var b=e.state||e[3];b?g.inArray(c,b)&&a.push(e):c==f.STATIC.INITIAL&&a.push(e)});return a},pushState:function(c){this.stateStack.push(c)},popState:function(){return this.stateStack.pop()},getStateStack:function(){return this.stateStack},showDebugInfo:function(){var c=f.STATIC.DEBUG_CONTEXT_LIMIT,a=this.matched,e=this.match,b=this.input,a=a.slice(0,a.length-e.length),a=(a.length>c?"...":"")+a.slice(-c).replace(/\n/," "),e=e+b,e=e.slice(0,c)+(e.length>c?"...":"");return a+e+"\n"+Array(a.length+
1).join("-")+"^"},mapSymbol:function(c){var a=this.symbolMap;return!a?c:a[c]||(a[c]=++this.symbolId)},mapReverseSymbol:function(c){var a=this.symbolMap,e,b=this.reverseSymbolMap;if(!b&&a)for(e in b=this.reverseSymbolMap={},a)b[a[e]]=e;return b?b[c]:c},mapState:function(c){var a=this.stateMap;return!a?c:a[c]||(a[c]=++this.stateId)},lex:function(){var c=this.input,a,e,b,o=this.getCurrentRules();this.match=this.text="";if(!c)return this.mapSymbol(f.STATIC.END_TAG);for(a=0;a<o.length;a++){e=o[a];var h=
e.token||e[0];b=e.action||e[2]||void 0;if(e=c.match(e.regexp||e[1])){if(a=e[0].match(/\n.*/g))this.lineNumber+=a.length;g.mix(this,{firstLine:this.lastLine,lastLine:this.lineNumber+1,firstColumn:this.lastColumn,lastColumn:a?a[a.length-1].length-1:this.lastColumn+e[0].length});a=this.match=e[0];this.matches=e;this.text=a;this.matched+=a;b=b&&b.call(this);b=void 0===b?h:this.mapSymbol(b);this.input=c=c.slice(a.length);return b?b:this.lex()}}}};f.STATIC={INITIAL:"I",DEBUG_CONTEXT_LIMIT:20,END_TAG:"$EOF"};
var j=new f({rules:[[2,/^"(\\"|\\\\|\\\/|\\b|\\f|\\n|\\r|\\t|\\u[0-9a-zA-Z]{4}|[^\\"\x00-\x1f])*"/,0],[0,/^[\t\r\n\x20]/,0],[3,/^,/,0],[4,/^:/,0],[5,/^\[/,0],[6,/^\]/,0],[7,/^\{/,0],[8,/^\}/,0],[9,/^-?\d+(?:\.\d+)?(?:e-?\d+)?/i,0],[10,/^true|false/,0],[11,/^null/,0],[12,/^./,0]]});m.lexer=j;j.symbolMap={$EOF:1,STRING:2,COMMA:3,COLON:4,LEFT_BRACKET:5,RIGHT_BRACKET:6,LEFT_BRACE:7,RIGHT_BRACE:8,NUMBER:9,BOOLEAN:10,NULL:11,INVALID:12,$START:13,json:14,value:15,object:16,array:17,elementList:18,member:19,
memberList:20};m.productions=[[13,[14]],[14,[15],function(){return this.$1}],[15,[2],function(){return this.yy.unQuote(this.$1)}],[15,[9],function(){return parseFloat(this.$1)}],[15,[16],function(){return this.$1}],[15,[17],function(){return this.$1}],[15,[10],function(){return"true"===this.$1}],[15,[11],function(){return null}],[18,[15],function(){return[this.$1]}],[18,[18,3,15],function(){this.$1[this.$1.length]=this.$3;return this.$1}],[17,[5,6],function(){return[]}],[17,[5,18,6],function(){return this.$2}],
[19,[2,4,15],function(){return{key:this.yy.unQuote(this.$1),value:this.$3}}],[20,[19],function(){var c={};c[this.$1.key]=this.$1.value;return c}],[20,[20,3,19],function(){this.$1[this.$3.key]=this.$3.value;return this.$1}],[16,[7,8],function(){return{}}],[16,[7,20,8],function(){return this.$2}]];m.table={gotos:{"0":{14:7,15:8,16:9,17:10},2:{15:12,16:9,17:10,18:13},3:{19:16,20:17},18:{15:23,16:9,17:10},20:{15:24,16:9,17:10},21:{19:25}},action:{"0":{2:[1,0,1],5:[1,0,2],7:[1,0,3],9:[1,0,4],10:[1,0,5],
11:[1,0,6]},1:{1:[2,2,0],3:[2,2,0],6:[2,2,0],8:[2,2,0]},2:{2:[1,0,1],5:[1,0,2],6:[1,0,11],7:[1,0,3],9:[1,0,4],10:[1,0,5],11:[1,0,6]},3:{2:[1,0,14],8:[1,0,15]},4:{1:[2,3,0],3:[2,3,0],6:[2,3,0],8:[2,3,0]},5:{1:[2,6,0],3:[2,6,0],6:[2,6,0],8:[2,6,0]},6:{1:[2,7,0],3:[2,7,0],6:[2,7,0],8:[2,7,0]},7:{1:[0,0,0]},8:{1:[2,1,0]},9:{1:[2,4,0],3:[2,4,0],6:[2,4,0],8:[2,4,0]},10:{1:[2,5,0],3:[2,5,0],6:[2,5,0],8:[2,5,0]},11:{1:[2,10,0],3:[2,10,0],6:[2,10,0],8:[2,10,0]},12:{3:[2,8,0],6:[2,8,0]},13:{3:[1,0,18],6:[1,
0,19]},14:{4:[1,0,20]},15:{1:[2,15,0],3:[2,15,0],6:[2,15,0],8:[2,15,0]},16:{3:[2,13,0],8:[2,13,0]},17:{3:[1,0,21],8:[1,0,22]},18:{2:[1,0,1],5:[1,0,2],7:[1,0,3],9:[1,0,4],10:[1,0,5],11:[1,0,6]},19:{1:[2,11,0],3:[2,11,0],6:[2,11,0],8:[2,11,0]},20:{2:[1,0,1],5:[1,0,2],7:[1,0,3],9:[1,0,4],10:[1,0,5],11:[1,0,6]},21:{2:[1,0,14]},22:{1:[2,16,0],3:[2,16,0],6:[2,16,0],8:[2,16,0]},23:{3:[2,9,0],6:[2,9,0]},24:{3:[2,12,0],8:[2,12,0]},25:{3:[2,14,0],8:[2,14,0]}}};m.parse=function(c){var a=this,e=a.lexer,b,f,h=
a.table,m=h.gotos,h=h.action,k=a.productions,d=[null],l=[0];for(e.resetInput(c);;){c=l[l.length-1];b||(b=e.lex());if(!b)return!1;f=h[c]&&h[c][b];if(!f){var j=[];h[c]&&g.each(h[c],function(b,c){j.push(a.lexer.mapReverseSymbol(c))});e.showDebugInfo();j.join(", ");return!1}switch(f[0]){case 1:l.push(b);d.push(e.text);l.push(f[2]);b=null;break;case 2:var i=k[f[1]],c=i.symbol||i[0];f=i.action||i[2];var n=(i.rhs||i[1]).length,q=0,i=d[d.length-n];a.$$=i;for(i=void 0;q<n;q++)a["$"+(n-q)]=d[d.length-1-q];
f&&(i=f.call(a));i=void 0!==i?i:a.$$;n&&(l=l.slice(0,-2*n),d=d.slice(0,-1*n));l.push(c);d.push(i);l.push(m[l[l.length-2]][l[l.length-1]]);break;case 0:return i}}};return m});
KISSY.add("json/parse",["./parser","./quote"],function(m,g){function f(a,c,b){var g=a[c],h,j,k;if("object"===typeof g)if(m.isArray(g)){h=0;j=g.length;for(var d=[];h<j;)k=f(g,""+h,b),void 0!==k&&(d[d.length]=k);g=d}else{d=m.keys(g);h=0;for(j=d.length;h<j;h++){var l=d[h];k=f(g,l,b);void 0===k?delete g[l]:g[l]=k}}return b.call(a,c,g)}var j=g("./parser"),c=g("./quote");j.yy={unQuote:c.unQuote};return function(a,c){var b=j.parse(""+a);return c?f({"":b},"",c):b}});
KISSY.add("json",["./json/stringify","./json/parse"],function(m,g){var f=g("./json/stringify"),j=g("./json/parse");return m.JSON={stringify:f,parse:j}});
